//
//  ViewController.swift
//  Swift封装网络工具类单例
//
//  Created by 蒋琪 on 2017/6/7.
//  Copyright © 2017年 jq. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let tool = LyNetWorkingTools.sharedTools

        let urlString = "http://www.weather.com.cn/data/sk/101010100.html"
        tool.responseSerializer.acceptableContentTypes?.insert("text/html")
        //afn的方法
//        tool.get(urlString, parameters: nil, progress: nil, success: { (_, responseObj) in
//            
//            print(responseObj!)
//            
//        }) { (_, error) in
//            
//            print(error)
//        }
        
        //自己的方法
        tool.request(method: .GET, urlString: urlString, parameters: nil) { (responseObj, error) in
            
            if error != nil{return}
            print(responseObj!)//请求成功
        }
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

